﻿using LK.WebAPI.ValidationAttributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace LK.WebAPI.RequestDto
{
    public class BasePage
    {
        public int pageIndex { get; set; }
        public int pageSize { get; set; }
    }

    public class BasePageTime : BasePage, IValidatableObject
    {
        [Required(ErrorMessage = "用户名必须填写")]
        [MinLength(6, ErrorMessage = "用户名长度过短")]
        public string UserName { get; set; }

        [FutureTime(ErrorMessage = "时间不能为将来")]
        public DateTime start { get; set; }
        [FutureTime(ErrorMessage = "时间不能为将来")]
        public DateTime end { get; set; }
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            List<ValidationResult> result = new List<ValidationResult>();
            if (true)
            {
                result.Add(new ValidationResult("时间区间不能大于三个月"));
            }
            return result;
        }
    }
}
